package cn.lyjuan.pojoutils.util;

import cn.lyjuan.pojoutils.bean.MySQLDBTypeBean;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by ly on 2014/11/23.
 */
public class MySQLDBTypeUtils
{
    /**
     * 普通MySQL数据库类型
     */
    private static final Map<Integer, MySQLDBTypeBean> dbTypes = new HashMap<Integer, MySQLDBTypeBean>();

    static
    {
        dbTypes.put(-7, new MySQLDBTypeBean(-7, "int", "_int", "INTEGER"));
        dbTypes.put(-6, new MySQLDBTypeBean(-6, "int", "_int", "INTEGER"));
        dbTypes.put(-5, new MySQLDBTypeBean(-5, "long", "_long", "BIGINT"));
        dbTypes.put(-4, new MySQLDBTypeBean(-4, "string", "string", "BLOB"));
        dbTypes.put(-3, new MySQLDBTypeBean(-3, "string", "string", "BLOB"));
        dbTypes.put(-1, new MySQLDBTypeBean(-1, "string", "string", "VARCHAR"));
        dbTypes.put(1, new MySQLDBTypeBean(1, "string", "string", "CHAR"));
        dbTypes.put(3, new MySQLDBTypeBean(3, "double", "_double", "DECIMAL"));
        dbTypes.put(4, new MySQLDBTypeBean(4, "int", "_int", "INTEGER"));
        dbTypes.put(5, new MySQLDBTypeBean(5, "int", "_int", "INTEGER"));
        dbTypes.put(7, new MySQLDBTypeBean(7, "float", "_float", "FLOAT"));
        dbTypes.put(8, new MySQLDBTypeBean(8, "double", "_double", "DOUBLE"));
        dbTypes.put(12, new MySQLDBTypeBean(12, "string", "string", "VARCHAR"));
        dbTypes.put(91, new MySQLDBTypeBean(91, "date", "date", "TIMESTAMP"));
        dbTypes.put(92, new MySQLDBTypeBean(92, "int", "_int", "INTEGER"));
        dbTypes.put(93, new MySQLDBTypeBean(93, "date", "date", "TIMESTAMP"));
    }

    public static MySQLDBTypeBean getDBType(int type)
    {
        return dbTypes.get(type);
    }
}




